﻿#ifndef FORMMODBUS_H
#define FORMMODBUS_H

#include <QWidget>
#include "myhead.h"
#include "basemodbus.h"
#include "writeregistermodel.h"

namespace Ui {
class FormModbus;
}

class FormModbus : public QWidget
{
    Q_OBJECT

public:
    explicit FormModbus(QWidget *parent = 0);
    ~FormModbus();

    void setComm(BaseModbus *modbus);

private slots:
    void on_readButton_clicked();

    void on_writeButton_clicked();

    void on_writeTable_currentIndexChanged(int index);

private:
    Ui::FormModbus *ui;
    BaseModbus *m_modbus=nullptr;
    WriteRegisterModel *writeModel=nullptr;

    void setCfgWidget(QWidget *w);
    void loadUiCfg();
    QStringList readData(QString dataType, int addr, int count);
};

#endif // FORMMODBUS_H